﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Plain.Demo.Blog.Business.Post>>" MasterPageFile="~/Layout/TwoColumn.master" %>
<asp:Content id="ctnHead" runat="server" ContentPlaceHolderID="Head">
	<script type="text/javascript" >
		$(function() {
			InitializeArchive("<%= Url.Action("Archive/Year","Blog") %>","<%= Url.Action("Archive/Month","Blog") %>","<%= Url.Action("Archive/List","Blog") %>");
			YearForward("<%= Url.Action("Archive/Year","Blog") %>","<%= Url.Action("Archive/Month","Blog") %>","<%= Url.Action("Archive/List","Blog") %>");
		});
	</script>
</asp:Content>
<asp:Content id="ctnColumn1" runat="server" ContentPlaceHolderID="Column1">
	<% foreach (var post in Model) { %> 
		<div class="Post">
			<h4><%= post.Title %></h4>
		    <%= post.Content %>
		    <span class="Tags">
		    	Tags: <% foreach (var tag in post.Tags) { %>
		    			<%= Html.ActionLink(tag, "ByTag", new { id=tag })%>
		    		  <% } %>
		    </span><span class="Comments"><%= Html.ActionLink("Comments(" + post.Comments.Count +")","Details", new { id= post.Id }) %></span>
    	</div>
	<% } %>
</asp:Content>
<asp:Content id="ctnColumn2" runat="server" ContentPlaceHolderID="Column2">
	<div id="PhotoFrame">
        <img src="/Images/shapeimage_2.png" alt="Kristian Gundry" />
    </div>
    <div id="Archive">
        <h4>Archive</h4>
        <ul>
        	<% for(int i=0;i<6;i++) { %>
        		<%if(Model.Where(x=>x.Published.Value.Year == DateTime.Now.Year - i).Count()> 0){%>
            		<li><a href="#" class="Year"><%= DateTime.Now.Year - i %> (<%= Model.Where(x=>x.Published.Value.Year == DateTime.Now.Year - i).Count()%>)</a></li>
            	<% } else{%>
            		<li><span><%= DateTime.Now.Year - i %> (<%= Model.Where(x=>x.Published.Value.Year == DateTime.Now.Year - i).Count()%>)</span></li>
            	<% } %>
            <% } %>
        </ul>
        <h6><span>&lt;&lt;</span> <span>year</span> <a href="#">&gt;&gt;</a></h6>
    </div>
</asp:Content>